function listProductType() {
    $.ajax({
        url : base + "/product_type/query_without_pager",
        data : $("#productType_query_form").serialize(),
        dataType : "json",
        success : function(data) {
            var list_html = "<tr><th>ID</th><th>产品类别名称</th><th>操作</th></tr>";
            for (var i = 0; i < data.list.length; i++) {
                var productType = data.list[i];
                var tmp = "<tr><td>" + productType.typeId + "</td><td>" + productType.typeName+
               
            	"</td><td><button type='button' class='btn btn-primary btn-sm' style='margin-right:30px;' " +
    			"onclick=\"location.href='" + base +"/jsp/productType_add.jsp?id=" + productType.typeId + "'\">修改</button>" +
    			
        			"<button type='button' class='btn btn-danger btn-sm' " +
        			"onclick='deleteProductType(" + productType.typeId + ");'>删除</button>" +
        			"</td></tr>";
                list_html += tmp;
            }
            $("#productTypes").html(list_html);
        }
    });
}

function deleteProductType(typeId) {
	if(confirm("是否删除？")) {
		$.ajax({
            url : base + "/product_type/delete",
            data : {"type_id":typeId},
            dataType : "json",
            success : function (data) {
                if (data.ok) {
                	listProductType();
                } else {
                    alert(data.msg);
                }
            }
        });
	}
}